/*
package com.cloud.tsp.config;

import com.cloud.api.domain.user.UserExtend;
import com.cloud.tsp.service.IUserExtendService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Slf4j
@Component
@Order(3)
public class UserExtendRunner implements CommandLineRunner {

    @Resource
    private IUserExtendService userExtendService;
    @Resource(name = "myRedis")
    private RedisTemplate<String,Object> redisTemplate;

    @Override
    public void run(String... args) throws Exception {
        List<UserExtend> list = userExtendService.list();
        Map<String, String> collect = list.stream().collect(Collectors.toMap(user -> "spring_cache_login_user::" + user.getUserId(), UserExtend::getName));
        redisTemplate.opsForValue().multiSet(collect);
    }
}
*/
